pub mod app;
pub use app::*;

mod reader;
pub use reader::Reader;

mod editor;
pub use editor::Editor;

pub trait ForceUnwrap<T: std::fmt::Debug> {
    fn force_unwrap(self) -> T;
}

impl<T: std::fmt::Debug> ForceUnwrap<T> for Option<T> {
    fn force_unwrap(self) -> T {
        match self {
            Some(t) => t,
            None => {
                println!("Unexpected found none value at {:?}", self);
                std::process::exit(0);
            }
        }
    }
}

impl<T: std::fmt::Debug, E: std::fmt::Debug> ForceUnwrap<T> for Result<T, E> {
    fn force_unwrap(self) -> T {
        match self {
            Ok(t) => t,
            Err(e) => {
                println!("Unexpected found error at {:?}", e);
                std::process::exit(0);
            }
        }
    }
}
